export default function hasPermission(app) {
    app.directive('limit', {
        mounted(el, binding) {
            if (!permsJudge(binding.value)) {
                el.parentNode.removeChild(el);
            }
            function permsJudge(value){
                let arr = JSON.parse(localStorage.getItem('permissions'))
                for (let item of arr) {
                    if (item.perms === value && item.hasRight==1) {
                        return true;
                    }
                }
                return false;
            }
        }
    });
}
